Four-dimensional Chern-Simons (4DCS) theory is useful for understanding integrable sigma-models and constructing new ones. In this paper, we show how to derive the complete pure spinor AdS5×S5 superstring sigma-model from 4DCS theory with defects. The matter sector of this sigma model was previously derived by Costello and Yamazaki, and we propose here that the pure spinor ghosts come from gauge-fixing meromorphic transformations of 4DCS which lead to the usual pure spinor Lax connection including the ghost contribution. Published by the American Physical Society 2024